function check(){
 
 var regm1 = /^[a-zA-Z0-9]+$/;
 if(form.mId.value==""){
  alert("请输入用户编号");
  form.mId.focus();
  return false;
 }
 if(!form.mId.value.match(regm1)){
  alert("编号格式不正确，只能由小写字母和数字组成！");
  form.mId.focus();
  return false;
 }
 if(form.username.value==""){
  alert("请输入用户名字");
  form.username.focus();
  return false;
 }
 if(!form.username.value.match(regm1)){
  alert("编号格式不正确，只能由小写字母和数字组成！");
  form.username.focus();
  return false;
 }
 if(form.password.value==""){
  alert("请输入用户密码");
  form.password.focus();
  return false;
 }
 if(form.password2.value==""){
  alert("请再次输入用户密码");
  form.password2.focus();
  return false;
 }
 if(form.password.value!= form.password2.value){
  alert("两次用户密码不一样，请仔细核对");
  form.password2.focus();
  return false;
 }
}
 
 function createXmlHttpRequest(){
	    var xmlreq = false;
	    if (window.XMLHttpRequest){
	        xmlreq = new XMLHttpRequest();
	    }else
	        if (window.ActiveXObject){
	    	try{
	    	    xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
	    	}catch(e1){
	    	    try{
	    	        xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
	    	    }catch(e2){
	    	}
	         }
	    }
	    return xmlreq;   	
	}

 
 function userNameCheck(){
     var request = createXmlHttpRequest();
     var username = document.all.username.value;
     request.open("post","nameCheckServlet?username="+username);
     request.send();
     request.onreadystatechange = function(){
 	if(request.readyState==4){
 	        var value = request.responseText;
 	        if(value=="true"){
 	                document.all.username.value="该用户已经存在"
     	                     }
                             }
     }
}